Skip to content

fix: process.ForEach JSON selection#40

Merged
shellcromancer merged 1 commit intomainfrom
dstinson-diess/fix-for-each
Dec 5, 2022
Merged

fix: process.ForEach JSON selection#40
shellcromancer merged 1 commit intomainfrom
dstinson-diess/fix-for-each

Conversation

@shellcromancer
Copy link
Contributor

Description

The ForEach JSON processor when used with the default jsonnet helpers pass an empty value for the inner processors input_key, this resulted in inner processor having a selection with a trailing . such as processor_type.. This fixes the issue by explicitly handling empty strings when checking the input/output keys.

Motivation and Context

  • Fixes usage of the for_each processor when used via jsonnet configurations.

How Has This Been Tested?

This has been tested with the regression suite, and locally by using configuring a processor via jsonnet as follows and getting the expected result, whereas before this no input would be captured from the input array.

// input: {"input_key": ["fizz", "buzz"]}
processlib.for_each('input_key', 'output_key', processlib.capture('', '', '(.*)'))

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

The ForEach JSON processor when used with the default jsonnet helpers
pass an empty value for the inner processors input_key, this resulted
in inner processor having a selection with a trailing "." such as
"processor_type.". This fixes by explicitly handling empty strings
when checking the input/output keys.
@shellcromancer shellcromancer marked this pull request as ready for review December 3, 2022 14:07
@shellcromancer shellcromancer requested a review from a team as a code owner December 3, 2022 14:07
@shellcromancer shellcromancer changed the title fix: ForEach JSON selection fix: process.ForEach JSON selection Dec 3, 2022
@shellcromancer shellcromancer merged commit e1a8ae5 into main Dec 5, 2022
@shellcromancer shellcromancer deleted the dstinson-diess/fix-for-each branch December 5, 2022 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants